# pip3 install pymysql
import pymysql

conn = pymysql.connect(host='192.168.1.20', user='root', password="root", db="pythonPC", port=3306,
                       charset="utf8")  # 链接数据库
cursor = conn.cursor()  # 光标对象
cursor.execute("insert into students(name,sex,grade)values(%s,%s,%s)", ('苏彦龙', '男', 26))  # 插入数据
conn.commit()

print('插入成功')
